<template>
    <div>
        <Popup @open="openPop" width="600px">
            <template #trigger>
                <el-button type="primary" size="small">免费更新</el-button>
            </template>
            <div v-loading="loading" v-if="status == true" class="flex flex-col items-center">
                <el-image class="w-[50px] h-[50px]" :src="successImg"></el-image>
                <div class="mt-4">
                    恭喜您，系统检测到您的域名已授权，可前往likeadmin.cn官网享受所有正版权益
                </div>
            </div>
            <div v-loading="loading" v-if="status == false" class="flex flex-col items-center">
                <el-image class="w-[50px] h-[50px]" :src="failImg"></el-image>
                <div class="mt-4">
                    很遗憾，系统检测到您的域名未授权，请前往likeadmin.cn官网【个人中心】-【产品授权】登记域名授权，否则将视为盗版行为!
                </div>
            </div>
        </Popup>
    </div>
</template>

<script setup lang="ts">
import Popup from '@/components/popup/index.vue'
import { genuineCheck } from '@/api/app'
import successImg from '@/assets/images/success.png'
import failImg from '@/assets/images/fail.png'

const loading = ref(true)
//授权状态 true-已授权 false-未授权
const status = ref<boolean>(false)

const openPop = async () => {
    try {
        const { data } = await genuineCheck()
        status.value = data.result
        loading.value = false
    } catch (error) {
        return
    }
}
</script>

<style scoped lang="scss"></style>
